package com.woniuxy.factory.controller;

import com.woniuxy.factory.entity.OrderRunit;
import com.woniuxy.factory.entity.ResponseResult;
import com.woniuxy.factory.service.OrderUnitServic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class OrderUnitController {
    @Autowired
    OrderUnitServic orderUnitServic;
    //根据订单编号查询指定订单项
    @ResponseBody
    @RequestMapping("/orderUnit")
    public ResponseResult<List<OrderRunit>> getOrderUnits(String ordId,int page,int limit){
        //调用service层方法
        ResponseResult<List<OrderRunit>> responseResult=orderUnitServic.getOrderUnits(ordId,page,limit);
        return responseResult;
    }

    //新增订单项
    @PostMapping("/addOrder")
    @ResponseBody
    public ResponseResult addOrderUnit(String ordId,String prdId,Integer orderNumber,String remark){
        ResponseResult responseResult = orderUnitServic.addOrderUnit(ordId,prdId,orderNumber,remark);
        return responseResult;
    }
}
